ssizez_t rio_writen(int fd,void *userbuf,size_t n)
{
	size_t nleft = n;
	ssize_t nwritten;
	char *bufp = userbuf;

	while (nleft >0){
		if((nwrite = write(fd,bufp,nleft))<=0){
			if(errn0==EINTR)
				nwritten = 0;
			else
				return -1;
		}
		nleft -= nwritten;
		bufp += nwritten;
	}
	return n;
}
